package com.adlotto2.lcdns.cronos.datahandler;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import android.util.Log;

public abstract class CNBaseDataParser 
{
	protected abstract void onParseContent(Element xmlObject,
			CNResultSet paramCNResultSet) throws Exception;

	public CNResultSet parse(Element xmlObject) throws Exception 
	{
		CNResultSet resultSet = null;

		if (xmlObject != null) 
		{
			resultSet = new CNResultSet();
			
			NodeList rcodeNode = xmlObject.getElementsByTagName("rcode");
			String rcode = rcodeNode.item(0).getFirstChild().getNodeValue();
			
//			NodeList rmsgNode = xmlObject.getElementsByTagName("rmsg");
//			String rmsg = rmsgNode.item(0).getFirstChild().getNodeValue();
			
			resultSet.setRcode(rcode);
//			resultSet.setRmsg(rmsg);
			
			onParseContent(xmlObject, resultSet);
			
		}

		return resultSet;
	}
}